package com.library.service.impl;

import com.library.bean.Book;
import com.library.mapper.BookMapper;
import com.library.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Resource
    private BookMapper bookMapper;
    @Override
    public List<Book> getBooks(Book book, Date beginDate, Date endDate) {
        return bookMapper.selectBookByCondition(book,beginDate,endDate);
    }

    @Override
    public int addBook(Book book) {
        return bookMapper.insertBook(book);
    }

    @Override
    public int deleteBook(int bookId) {
        return bookMapper.deleteBook(bookId);
    }

    @Override
    public Book getBookById(int bookId) {
        return bookMapper.selectBookById(bookId);
    }

    @Override
    public int updateBook(Book book) {
        return bookMapper.updateBook(book);
    }

    @Override
    public int updateBookCover(int bookId, String bookCover) {
        return bookMapper.updateBookCover(bookId,bookCover);
    }


}
